package com.suli.account.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suli.account.entity.Scenic;
import com.suli.account.entity.UserTicket;
import com.suli.account.enums.ScenicType;
import com.suli.account.enums.TicketStatus;
import com.suli.account.mapper.ScenicMapper;
import com.suli.account.service.ScenicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SuLi
 * @since 2022-04-14
 */
@Service
public class ScenicServiceImpl extends ServiceImpl<ScenicMapper, Scenic> implements ScenicService {

    @Autowired
    ScenicMapper scenicMapper;

    @Override
    public Map<String, Object> getScenicCount() {
        QueryWrapper<Scenic> queryWrapper=new QueryWrapper<>();
        Long aLong = scenicMapper.selectCount(null);
        Map<String,Object> map=new HashMap<>();
        map.put("AllCount", aLong);
        return map;
    }

    @Override
    public Map<String, Object> getCountByType(String scenicType) {
        QueryWrapper<Scenic> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("scenic_type", ScenicType.valueOf(scenicType));
        Long aLong = scenicMapper.selectCount(queryWrapper);
        Map<String,Object> map=new HashMap<>();
        map.put("AllCount", aLong);
        return map;
    }
}
